import java.util.Arrays;

public class Text2 {
    public static boolean function(int[] array){
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 != 0){
                count++;
                if(count == 3){
                    return true;
                }
            }else{
                count = 0;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        int[] array = {1,2,3,5,7,2};
        boolean flg = function(array);
        System.out.println(flg);

    }


    public static int moreNum(int[] array) {
        Arrays.sort(array);
        return array[array.length/2];
    }

    public static void main4(String[] args) {
        int[] array = {3,2,3};
        int ret = moreNum(array);
        System.out.println(ret);
    }

    public static int singleNum(int[] array){
        int ret = 0;
        for (int i = 0; i < array.length; i++) {
            ret ^= array[i];
        }
        return ret;
    }



    public static int[] twoIndex(int[] array,int target){
        int[] tmp = {-1,-1};
        for (int i = 0; i < array.length; i++) {
            for (int j = i+1; j <array.length ; j++) {
                if(array[i] + array[j] == target){
                    tmp[0] = i;
                    tmp[1] = j;
                }
            }
        }
        return tmp;
    }

    public static void main3(String[] args) {
        int[] array = {2,7,11,15};
        int[] ret = twoIndex(array,9);
        System.out.println(Arrays.toString(ret));
    }



    private static void swap(int[] array,int i,int j){
        int tmp = array[j];
        array[j] = array[i];
        array[i] = tmp;
    }

    private static void func(int[] array){
        int i = 0;
        int j = array.length - 1;
        while(i < j){
            while(i < j && array[i] % 2 != 0){
                i++;

            }
            while(i < j && array[j] % 2 == 0){
                j--;
            }
            swap(array,i,j);

        }
    }

    public static void main2(String[] args) {
        int[] array = {1,2,3,4,5};
        func(array);
        System.out.println(Arrays.toString(array));
    }

    public static void transform(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
    }

    public static void main1(String[] args) {
        int[] array = {1, 2, 3, 4, 5};
        transform(array);
        System.out.println(Arrays.toString(array));

    }

}
